<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<div class="container bs-docs-container" style="margin-top: 20px">
    @if (Session::has('success'))
        <div class="alert alert-success">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
            {{ Session::get('success') }}
        </div>
    @endif
    <a href="{{ route('permission.add') }}" type="button" class="btn btn-primary pull-right">添加权限</a>
    <ul class="list-group" style="margin-top: 40px">
        @foreach($permissions as $permission)
            <li class="list-group-item list-group-item-success">{{$permission->id}}.{{ $permission->alias }}&nbsp;<span class="label label-warning">{{$permission->name}}</span></li>
            @if(!empty($permission->children))
                <ul class="list-group">
                 @foreach($permission->children as $depth1)
                    <li class="list-group-item">╚══{{$depth1->id}}.&nbsp;{{$depth1->alias}}&nbsp;<span class="label label-warning">{{$depth1->name}}</span></li>
                        @if(!empty($depth1->children))
                                <ul class="list-group"  style="margin-bottom: 0px">
                                    @foreach($depth1->children as $depth2)
                                    <li class="list-group-item">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╚══{{$depth2->id}}.&nbsp;{{$depth2->alias}}&nbsp;<span class="label label-warning">{{$depth2->name}}</span></li>
                                    @endforeach
                                </ul>
                        @endif
                 @endforeach
                </ul>
            @endif
        @endforeach
    </ul>
</div>